package com.foodsafe.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.foodsafe.dao.AdditiveDao;
import com.foodsafe.model.Additive;
import com.foodsafe.model.Additivecategory;
import com.foodsafe.util.PageInfo;

@Component("AdditiveService")
public class AdditiveService {
	private AdditiveDao additiveDao;

	public AdditiveDao getAdditiveDao() {
		return additiveDao;
	}
	@Resource
	public void setAdditiveDao(AdditiveDao additiveDao) {
		this.additiveDao = additiveDao;
	}
	public List<Additive> queryAdditive(PageInfo pageInfo) throws Exception {
		
		return additiveDao.queryAdditive(null);
	}
	public List<Additivecategory> getAllAdditivecategories() throws Exception {
		
		return this.additiveDao.getAllAdditivecategories();
	}
	public void addAdditive(Additive additive) throws Exception {
		this.additiveDao.addAdditive(additive);
		
	}
	public void deleteAdditive(int[] additiveIds) throws Exception {
		this.additiveDao.deleteAdditive(additiveIds);
		
	}
	public Additive getAdditiveInfoById(int additiveId) throws Exception {
		
		return 	this.additiveDao.getAdditiveInfoById(additiveId);
	}
	public void editAdditive(Additive additive) {
		this.additiveDao.editAdditive(additive);
		
	}
}
